﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using HigLabo.Net.Extensions;

namespace HigLabo.Net.WindowsLive
{
    /// <summary>
    /// 
    /// </summary>
    public class Permissions : Dictionary<String, Object>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsontext"></param>
        public Permissions(String jsontext)
        {
            var d = Common.SetData(jsontext).ToString("data");
            var cc = JsonConvert.DeserializeObject(d) as JContainer;
            foreach (var s in WindowsLiveClient.CreateJsonTextList(cc))
            {
                var txt = Common.SetData(s);
                foreach (var t in txt)
                {
                    this.Add(t.Key, t.Value);
                }
            }
        }
    }
}
